package common.database.bean;

public class Page {
	private Object result;
	private int totalCount;
	private int start;
	private int pageSize = 20;
	private int curPage =1;
	private int totalPage;

	public Page(int currentPage) {
		if(currentPage==0){
			currentPage =1;
		}
		this.curPage = currentPage;
		start = (currentPage-1) * pageSize;
	}
	
	public Page(int currentPage,int pageSize) {
		if(currentPage==0){
			currentPage =1;
		}
		this.pageSize = pageSize;
		this.curPage = currentPage;
		start = (currentPage-1) * pageSize;
	}

	public int getTotalPage() {
		return totalCount % pageSize == 0 ? totalCount / pageSize
				: (totalCount / pageSize) + 1;
	}

	public int getCurPage() {
		return curPage;
	}

	public void setCurPage(int curPage) {
		this.curPage = curPage;
	}

	public Object getResult() {
		return result;
	}

	public void setResult(Object result) {
		this.result = result;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	public int getStart() {
		return start;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
}
